/**
 * @file   test5.cpp
 * @author Kimmo Luoma <kimmo@PHOTON3>
 * @date   Tue Oct  9 12:43:05 2012
 * 
 * @brief  Simple test for mediator class
 * 
 * 
 */

#include "mediator.hpp"
#include "density_matrix.hpp"
using namespace QuantumWalk;

int main(){
  typedef std::complex<double> cmplx;
  //We use identity for coin and shift.
  int N=2;
  int d=2;
  //We use state in position 0 with internal state 0;
  
  matrix<cmplx> psi(d,N,0);
  psi(0,0)=1;
  density_matrix<cmplx> rho(psi);

  //Identity coin
  matrix<cmplx> c(d,d,0);
  c(0,0)=1;c(1,1)=1;
  coin<cmplx> coin(c,d,N);

  //Identity shift
  matrix<cmplx> v(N,N,0);
  for(int i=0;i<N;i++){
    v(i,i)=1;
  }
  shift<cmplx> S(d,N);
  S.add_op(0,v);
  S.add_op(1,v);

  mediator<cmplx> m(rho,coin,S);
  //m.print();
  
  //Check
  matrix<cmplx> rho_c(N*d,N*d,0);
  rho_c(0,0)=1;
  identity_matrix<cmplx> coin_c(N*d);
  identity_matrix<cmplx> shift_c(N*d);
  
  //should result zero matrices
  std::cout<<m.rho()-rho_c<<std::endl;
  std::cout<<m.coin()-coin_c<<std::endl;
  std::cout<<m.shift()-shift_c<<std::endl;
}
